/**
 * 波浪流动效果
 * */

const renderEngine = cc.renderer.renderEngine;
const renderer = renderEngine.renderer;

const shader = {
    name: "WaveLine",
    params: [
        {name: '_color', type: renderer.PARAM_FLOAT3},
    ],
    
    defines: [],

    start(sprite, material) {
        this._start = Date.now();

        var _color = new cc.Vec3(0,1,1);
        material.setParamValue("_color", _color);

    },

    update(sprite, material) {
        // const now = Date.now();
        // const time = (now - this._start) / 1000;
        // material.setParamValue('iTime', time);
    },

    vert: `uniform mat4 viewProj;
        attribute vec4 a_position;
        attribute vec2 a_uv0;
        varying vec2 uv0;

        void main()
        {
            gl_Position = viewProj * a_position;
            uv0 = a_uv0;
        }
        `,

    frag: `
        uniform sampler2D texture;
        uniform vec3 _color;
        varying vec2 uv0;
        
        void main() {
            gl_FragColor = vec4(_color,1);
        }`
};

let CustomMaterial = require('CustomMaterial');
CustomMaterial.addShader(shader);